<?php
ob_start();
$email=trim($_POST['email']);
$password=md5($_POST['password']);
include('config.php');
mysql_select_db(SAE_MYSQL_DB ,$conn) or die();

$sqlstr="SELECT id,email,password FROM dcsmember WHERE email='$email' AND password='$password'";

$result=mysql_query($sqlstr,$conn) or die();
$row=mysql_fetch_array($result); 
if($row){
$loginuser=$row['email']; 
$loginpas=$row['password'];
$loginid=$row['id']; 
session_start();
$_SESSION['user']=$loginuser;
$_SESSION['uid']=$loginid;
header("Location:home.php");
exit;
}
else{
echo '登陆失败，你可能使用了错误的用户名或密码，请检查';
echo "<script>window.location.href='index.php';</script>";
}
ob_flush();
?>